package com.ccys.cms.controller.masterData;

import com.ccys.cms.service.masterData.MedicationUsagePeriodService;
import com.ccys.common.constants.TouristApi;
import com.ccys.common.vo.ResponseResult;
import com.ccys.db.dto.masterData.*;
import com.ccys.db.vo.masterData.MedicationUsagePeriodPageVo;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @program: WhiteCoat
 * @description: 用药周期接口
 * @author: ZhangJingCan
 * @create: 2023-12-11 18:04
 **/

@RestController
@RequestMapping("masterData")
@Api(tags = "masterData-用药周期接口")
public class MedicationUsagePeriodController {

    @Autowired
    private MedicationUsagePeriodService medicationUsagePeriodService;


    
    @PostMapping("medicationUsagePeriod")
    @ApiOperation("保存用药周期")
    public ResponseResult save(MedicationUsagePeriodSaveDto dto) {
        return medicationUsagePeriodService.save(dto);
    }


    @PutMapping("medicationUsagePeriod")
    @ApiOperation("修改用药周期")
    public ResponseResult edit(MedicationUsagePeriodSaveDto dto) {
        return medicationUsagePeriodService.save(dto);
    }
    
    @DeleteMapping("medicationUsagePeriod")
    @ApiOperation("根据ID删除用药周期")
    public ResponseResult delete(MedicationUsagePeriodDelDto dto) {
        return medicationUsagePeriodService.delete(dto);
    }

    
    @GetMapping("medicationUsagePeriod")
    @ApiOperation("分页查询用药周期")
    public ResponseResult<PageInfo<MedicationUsagePeriodPageVo>, Object> findPage(MedicationUsagePeriodPageQueryDto dto) {
        return medicationUsagePeriodService.findPage(dto);
    }


}
